# This program mainly Demonstrates the use of "Input Dialog"
# I have also made message box again in this program to understand its functionality
# The list of default message boxes can be found under the static functions list at
# srinikom.github.io/pyside-docs/PySide/QtGui/QMessageBox.html
# Messageboxes include - about, critical, question, warning, aboutQt

import sys
from PySide import QtGui, QtCore

class Window(QtGui.QMainWindow):
    def __init__(self):
        super(Window, self).__init__()

        self.btn1 = QtGui.QPushButton("Dialog", self)
        self.btn1.move(20, 20)
        self.btn1.clicked.connect(self.showDialog)

        self.btn2 = QtGui.QPushButton("MessageBox", self)
        self.btn2.move(20, 50)
        self.btn2.clicked.connect(self.showMsgBox2)

        self.btn3 = QtGui.QPushButton("Create", self)
        self.btn3.move(20, 80)
        self.btn3.clicked.connect(self.showMsgBox3)

        self.lineEdit = QtGui.QLineEdit(self)
        self.lineEdit.move(130, 22)

        self.setGeometry(200, 200, 300, 200)
        self.setWindowTitle("Input Dialog")

    def showDialog(self):
        text, ok = QtGui.QInputDialog.getText(self, "Input Dialog", "Enter yer name")
        if ok:
            self.lineEdit.setText(str(text))

    def showMsgBox2(self):
        msgBox2 = QtGui.QMessageBox.critical(self, "Title", "Very Critical info.. oooo",
                                             QtGui.QMessageBox.Yes | QtGui.QMessageBox.Abort |QtGui.QMessageBox.Cancel)
        if msgBox2 == QtGui.QMessageBox.Yes:
            self.lineEdit.setText("Yessss")
        elif msgBox2 == QtGui.QMessageBox.Abort:
            self.lineEdit.setText("Aborted")
        elif msgBox2 == QtGui.QMessageBox.Cancel:
            self.lineEdit.setText("Cancelled")

    def showMsgBox3(self):
        self

if __name__ == "__main__":
    appObject = QtGui.QApplication(sys.argv)
    ex = Window()
    ex.show()
    sys.exit(appObject.exec_())